/* Copyright (C) 2021 Maxime Devos <maximedevos at telenet dot be>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U>
*/

/* Add this to guile's source code with a patch
   (as a source code patch or a static library
   to link with) if  XXX elaborate & test & (optionally) use*/

#define _GNU_SOURCE

#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <libguile.h>
#include <stdint.h>

#define EXPORT(name, cfunc)					\
  scm_c_define(name, scm_from_uintptr_t((uintptr_t) &cfunc))

void
init_fs_at_pointers (void)
{
  EXPORT("p:openat", openat);
  EXPORT("p:fchmodat", fchmodat);
  EXPORT("p:fchownat", fchownat);
  EXPORT("p:__xmknodat", __xmknodat);
  EXPORT("p:__fxstatat", __fxstatat64);
}
